import { WidgetCustomGroup } from '../types';

export const getAttributeValue: (
  list: WidgetCustomGroup[] | undefined,
  field: string,
  index?: number,
) => any = (customAttribute, field, index = 0) => {
  const groupItem = customAttribute?.[index];
  const fieldItem = groupItem?.list.find((v) => v.field === field);
  return fieldItem?.value;
};
